package com.ax.api.route.util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;

public class RouteConfig {

	@Autowired
    LoadBalancerClient loadBalancerClient;
	
	public static final String BASE_ROUTE="remote-base";
	
	public static final String BUSSINESS_ROUTE="remote-business";
	
	public static final String ASSOCIATOR_ROUTE="remote-associator";
	
	public String bussiness(String path){
		ServiceInstance serviceInstance = loadBalancerClient.choose(RouteConfig.BUSSINESS_ROUTE);
	    String url = "http://" + serviceInstance.getHost() + ":" + serviceInstance.getPort()+path;
	    return url; 
	}
	
}
